#include "segmentationviewdialog.h"
#include "ui_segmentationviewdialog.h"
#include "mainapp.h"
#include <QDebug>
#include <windows.h>
#include <QMainWindow>
#include <QtGui/qevent.h>
#include "segmentation.h"

SegmentationViewDialog::SegmentationViewDialog(QWidget *parent, MainApp *_app) : QDialog(parent), ui(new Ui::SegmentationViewDialog)
{
    ui->setupUi(this);
    m_MainApp = _app;

    ui->label_3->setPixmap(*m_MainApp->m_ProcWnd->m_Label->pixmap());

    //s_Img = img;

    //s_Wnd = new ImgWindow(this);
    //s_Wnd->setGeometry(20, 20, ui->m_Img->GetImgWidth(), s_Img->GetImgHeight());
    //s_Wnd->setWindowTitle("Obraz posegmentowany");
    //s_Wnd->m_Label = new QLabel(m_OrigWnd);
    //s_Wnd->m_Label->setFrameShape(QFrame::Shape::Box);

}

SegmentationViewDialog::~SegmentationViewDialog()
{
    delete ui;
}
void SegmentationViewDialog::SetWindow(int w, int h, QImage *img){
    qDebug()<<"w set wndw";
    s_Wnd = new ImgWindow(this);
    s_Wnd->setGeometry(20, 20, w, h);
    s_Wnd->setWindowTitle("Obraz posegmentowany");
    s_Wnd->m_Label = new QLabel(s_Wnd);
    //s_Wnd->m_Label->setFrameShape(QFrame::Shape::Box);
    qDebug()<<"ustawione";
    //s_Wnd->m_Label->setPixmap(QPixmap::fromImage(img));
    //s_Wnd->show();
}
void SegmentationViewDialog::mousePressEvent( QMouseEvent * event ){
    qDebug()<<event->x()-30;
    qDebug()<<event->y()-60;
    posX=event->x()-30;
    posY=event->y()-60 ;
    //m_MainApp->m_ProcWnd->m_Label->setPixmap();
    (m_MainApp->GetImg()->GetSeg())->DisplaySegment(posX,posY);

    //m_MainApp->m_ProcWnd->m_Label->setPixmap(QPixmap::fromImage((m_MainApp->GetImg()->GetSeg()->GetData())));
            //m_Label->setPixmap(QPixmap::fromImage(*m_Img->m_Fourier->GetData()));
}
